package service

import (
	"context"
	"fmt"

	"github.com/go-kratos/kratos/v2/log"

	club_v1 "ruquan/api/club/v1"
	"ruquan/internal/club/biz"
)

type ClubService struct {
	club_v1.UnimplementedClubServer

	uc  *biz.ClubUsecase
	log *log.Helper
}

func NewClubService(uc *biz.ClubUsecase, logger log.Logger) *ClubService {
	return &ClubService{uc: uc, log: log.NewHelper("service/club", logger)}
}

func (s *ClubService) CreateClub(ctx context.Context, req *club_v1.CreateClubRequest) (*club_v1.CreateClubReply, error) {
	s.log.Infof("CreateClub Received: %v", req.Uuid)
	club := &biz.Club{
		Uuid: req.Uuid,
	}

	err := s.uc.Create(ctx, club)
	if err != nil {
		return nil, err
	}

	return &club_v1.CreateClubReply{Message: fmt.Sprintf("Hello %v", club.Uuid)}, nil
}
func (s *ClubService) UpdateClub(ctx context.Context, req *club_v1.UpdateClubRequest) (*club_v1.UpdateClubReply, error) {
	return &club_v1.UpdateClubReply{}, nil
}
func (s *ClubService) DeleteClub(ctx context.Context, req *club_v1.DeleteClubRequest) (*club_v1.DeleteClubReply, error) {
	return &club_v1.DeleteClubReply{}, nil
}
func (s *ClubService) GetClub(ctx context.Context, req *club_v1.GetClubRequest) (*club_v1.GetClubReply, error) {
	return &club_v1.GetClubReply{}, nil
}
func (s *ClubService) ListClub(ctx context.Context, req *club_v1.ListClubRequest) (*club_v1.ListClubReply, error) {
	return &club_v1.ListClubReply{}, nil
}
